package comp353Games;

import java.awt.Container;

/**
 * GameModel gives the template for a general combinatorial game
 *
 * @author Tyler Radley, Andre Harvey, Deanna Fink
 * @version 4/30/12
 */
public interface GameModel {
//constants
    /**
     * A constant representing Player 1
     */
    public static final int PLAYER_ONE = 1;
    /**
     * A constant representing Player 2
     */
    public static final int PLAYER_TWO = 2;
    /**
     * Returns the name of the current game.
     *
     * @return The name of the current game.
     */
    public String getName();

    /**
     * Returns any additional instructions to play the selected game.
     *
     * @return a string array specifying additional instructions to properly
     * play the game.
     */
    public String[] getInstructions(int currentPlayer);

    /**
     * Returns a new instance of the current game with the board reset.
     *
     * @return a new instance of the current game with the board reset.
     */
    public GameModel getNewGame();

    /**
     * Generates the formatted code to be stored in the save file.
     *
     * @return a string containing the save formatted code.
     */
    public String save();

    /**
     * Parses the string version of the save txt file and loads it into a new
     * game.
     *
     * @return a new game generated from the save string.
     */
    public GameModel load(String loadString);

    /**
     * Returns a new instance of the Display for the current game.
     *
     * @param game The new game that will be displayed
     * @return a new instance of the Display for the current game
     */
    public Container getDisplay(GameModel game);

    /**
     * Checks to see if the position that was clicked corresponds to a valid
     * move
     *
     * @param gamePress parameters of the position in which the mouse was
     * pressed
     * @param gameRelease parameters of the position in which the mouse was
     * released
     * @param gameClick parameters of the position in which the mouse was
     * clicked
     * @param currentPlayer the current player in the game
     * @return whether or not the move was valid
     */
    public boolean validMove(int[] gamePress, int[] gameRelease, int[] gameClick, int currentPlayer);

    /**
     * Creates a new version of the game
     *
     * @param gamePress parameters of the position in which the mouse was
     * pressed
     * @param gameRelease parameters of the position in which the mouse was
     * released
     * @param gameClick parameters of the position in which the mouse was
     * clicked
     * @return a new GameModel
     */
    public GameModel updateGame(int[] gamePress, int[] gameRelease, int[] gameClick, int currentPlayer);

    /**
     * Uses the information from a mouse press to create parameters that can be
     * passed into the game
     *
     * @param xPosition the x position from where the mouse was pressed
     * @param yPosition the y position from where the mouse was pressed
     * @return an array containing game position where the mouse was pressed
     */
    public int[] mousePressedHandler(int xPosition, int yPosition);

    /**
     * Uses the information from a mouse release to create parameters that can
     * be passed into the game
     *
     * @param xPosition x position where the mouse was released
     * @param yPosition y position where the mouse was released
     * @return an array containing game position where the mouse was released
     */
    public int[] mouseReleasedHandler(int xPosition, int yPosition);

    /**
     * Uses the information from a mouse click to create parameters that can be
     * passed into the game
     *
     * @param xPosition the x position from where the mouse was clicked
     * @param yPosition the y position from where the mouse was clicked
     * @param currentPlayer the current player in the game
     * @return an array containing game position where the mouse was clicked
     */
    public int[] mouseClickedHandler(int xPosition, int yPosition, int currentPlayer);

    /**
     * Determines whether there are any valid moves for the current player.
     *
     * @param currentPlayer the player number
     * @return Whether this game has any moves for the current player.
     */
    public boolean hasMovesRemaining(int currentPlayer);

    @Override
    public int hashCode();
}

